<?php  
function display_tag_attributes($tag){
	$query = "SELECT * FROM TagAttributes WHERE tag='$tag'";
	$result = mysql_query($query);
	$index = 0;
	echo "Current Attributes : <br><br><br>";
	while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
		$value = $row['value'];
		$rel = $row['relation'];
		$attr = $row['attribute'];
		if($index++==0){
			echo "IF $attr $rel $value<br>";
		} else {
			echo "AND $attr $rel $value<br>";
		}
	}
}
;?>